<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>咕咕米后台管理系统</title>
    <link rel="stylesheet" href="vendors/layui-v2.4.5/css/layui.css">
    <link rel="stylesheet" href="css/index.css">
</head>

<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">咕咕米后台</div>
            <!-- 头部区域（可配合layui已有的水平导航） -->
            <ul class="layui-nav layui-layout-left" id="nav">
                <li class="layui-nav-item"><a href="javascript:;" page='dashboard'>Dashboard</a></li>
                <li class="layui-nav-item"><a href="javascript:;" page='offical'>官网管理</a></li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                        老郑
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="">基本资料</a></dd>
                        <dd><a href="">安全设置</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">退了</a></li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll" id="sidebar">
                <dl class="layui-nav layui-nav-tree" nav="dashboard" style="display:block">
                    <dt class="sidebar-nav-title">首台首页</dt>
                    <dd class="layui-nav-item"><a href="dashboard.html" target="main">Dashboard</a></dd>
                    <dd class="layui-nav-item">
                        <a href="https://www.baidu.com" target="main">Google</a>
                    </dd>
                </dl>
                <dl class="layui-nav layui-nav-tree" nav="offical">
                    <dt class="sidebar-nav-title">官网管理</dt>
                    <dd class="layui-nav-item">
                        <a class="" href="javascript:;">关于我们</a>
                        <ul class="layui-nav-child">
                            <li><a href="javascript:;">页面内容</a></li>
                            <li><a href="javascript:;">联系方式</a></li>
                        </ul>
                    </dd>
                    <dd class="layui-nav-item">
                        <a class="" href="javascript:;">产品管理</a>
                        <ul class="layui-nav-child">
                            <li><a href="javascript:;">产品管理</a></li>
                            <li><a href="javascript:;">分类管理</a></li>
                            <li><a href="javascript:;">标签管理</a></li>
                        </ul>
                    </dd>
                    <dd class="layui-nav-item"><a href="">订单管理</a></dd>
                    <dd class="layui-nav-item"><a href="">财务管理</a></dd>
                </dl>
                <!-- 以上是示例内容 -->


            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <iframe src="dashboard.html" id="iframe" name="main" frameborder=0 height="100%" width="100%">
                <h1>同学~，你的浏览器不支持iframe</h1>
            </iframe>
        </div>

        <div class="layui-footer">
            <!-- 底部固定区域 -->
            © <a href="mailto:78501051@qq.com">郑博</a>
        </div>
    </div>
</body>
<script src='vendors/layui-v2.4.5/layui.all.js'></script>
<script>
    layui.use(['jquery'], function () {
        var $ = layui.jquery

        // 获取所有边栏的子栏目
        var subNavs = $('#sidebar>.layui-nav')
        // 定义默认显示的子栏目
        var showingSub = 0

        // 顶部导航点击引起左侧边栏变化
        $('#nav>.layui-nav-item').on('click', 'a', function () {
            var page = $(this).attr('page')
            for (var i = 0; i < subNavs.length; i++) {
                var subNavsDl = $(subNavs[i])
                subNavsDl.css({ display: subNavsDl.attr('nav') === page ? 'block' : 'none' })
            }
        })

    });
</script>

</html>
